package com.xiaoq.matrix.minipro.util;

import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import com.xiaoq.matrix.minipro.config.WechatOpenProperties;

/**
 * @author <a href="https://github.com/007gzs">007</a>
 */

public class WxOpenCryptUtil extends me.chanjar.weixin.common.util.crypto.WxCryptUtil {

	public WxOpenCryptUtil() {
		//没办法从配置项里面拿出来
		WechatOpenProperties wechatOpenProperties = new WechatOpenProperties();
		wechatOpenProperties.setComponentAppId("wxe0ebdcdeff620f56");
		wechatOpenProperties.setComponentSecret("39a4d40d76c02fc4e1264c7db4454331");
		wechatOpenProperties.setComponentToken("cYmgSSUHYGXFA1iG7ZSaCDIOQnaAMBCydRgNxHP8Dwa");
		wechatOpenProperties.setComponentAesKey("gyNpV92zdaw1iIEp9SU0wLQtanY4HPE756G1e9Ifz7m");
		String encodingAesKey = wechatOpenProperties.getComponentAesKey();
		String token = wechatOpenProperties.getComponentToken();
		String appId = wechatOpenProperties.getComponentAppId();

		this.token = token;
		this.appidOrCorpid = appId;
		this.aesKey = Base64.decodeBase64(encodingAesKey + "=");
	}
}
